/**
* @description : 标签关联详情
* @descriptionDetail : 标签关联详情
* @copyright : 辽宁烟草
* @author : mc
* @create : 2022-12-05 15:33:20
*/
<template>
	<view>
    <view class="retail">
      <fsection :title="title.basemsg" class="pl-16"></fsection>
      <u-gap :height="$theme.cm_section_top_gap_height" :bg-color="$theme.cm_gap_color"></u-gap>
    </view>
    <view class="content u-page">
      <view class="main">
        <view v-if="allData.length === 0" class="no-data">
          ~ 暂无数据 ~
        </view>
        <view v-else v-for="(item,index) in allData" :key="index">
          <view class="label_title">
            <u-section
                :title="`${item.categoryName}`"
                :right="false"
                :line-color="`${item.categoryColor}`"
                font-size="28"
            ></u-section>
          </view>
          <view class="label_cont">
            <p>{{ item.labelList.map(item => item.labelName).join('、') }}</p>
          </view>
        </view>
      </view>
    </view>
	</view>
</template>

<script>
	import commonService from "@/service/score/score.service.js";
	import fabButton from '@/components/uni-fab.vue';
  import fsection from "@/components/form-section.vue";
	export default {
		components: {
			fabButton,fsection
		},
		props: ['licNo', ],
		data() {
			return {
        title: {
          basemsg: "标签信息",
        },
				allData: [],
			};
		},
		mounted() {
			// this.setRightBtns();
			this.loadData();

		},
		onLoad() {
			// document.addEventListener( "keydown", this.keypress );
			this.licNoCache = this.getRouteParam();
			this.inti()
		},
		onUnload() {
			console.log( 'onUnload' );
		},
		methods: {
			inti(){
				this.licNo = this.licNoCache.licNo
				this.loadData();
			},
			loadData( ) {
				commonService.getLabelDetail({
					licNo: this.licNo,
					// licNo: '130123100094',
				} ).then( res => {
					if ( res.success ) {
						this.allData = res.data
            console.log(this.allData);
						this.ycfxList = ''
						this.jyxzList = ''
						this.dlwzList = ''
						this.xktzList = ''
						this.otherList = ''
						res.data.forEach(item=>{
							if(item.categoryName == '异常风险类'){
								let mould = []
								for(let i in item.labelList){
									mould.push(item.labelList[i].labelName)
								}
								this.ycfxList = mould.join('、')
							}
							if(item.categoryName == '经营性质类'){
								let mould = []
								for(let i in item.labelList){
									mould.push(item.labelList[i].labelName)
								}
								this.jyxzList = mould.join('、')
							}
							if(item.categoryName == '地理位置类'){
								let mould = []
								for(let i in item.labelList){
									mould.push(item.labelList[i].labelName)
								}
								this.dlwzList = mould.join('、')
							}
							if(item.categoryName == '许可特征类'){
								let mould = []
								for(let i in item.labelList){
									mould.push(item.labelList[i].labelName)
								}
								this.xktzList = mould.join('、')
							}

						})


					} else {
						this.$modal.alert( res.msg );
						this.allData = ''
						this.ycfxList = ''
						this.jyxzList = ''
						this.dlwzList = ''
						this.xktzList = ''
						this.otherList = ''
					}
				} ).catch( err => {
					this.$modal.alert( "请求失败" );
					this.allData = ''
					this.ycfxList = ''
					this.jyxzList = ''
					this.dlwzList = ''
					this.xktzList = ''
					this.otherList = ''
				} );
			},
			dataClick(){
				this.loadData();
			}



		},
	};
</script>

<style lang="scss" scoped>
@import "@/pages/query/nolicence/unlicense_item.scss";
@import "@/pages/query/nolicence/detailCommon/common/listItem.scss";

  .head-title {
    padding: 0rpx 12rpx 0rpx 12rpx;
    font-size: $cm_form_item_label_font_size;
    font-weight: bold;
  }

	.main {
		background-color: $uni-bg-color-grey;
		min-height:100vh;
		padding-bottom:30px;
	}
	.label_title{
		padding:10px 20px;
		background:#fff;
		margin-bottom:10px;
		span{
			float:left;
			font-size:12px;
			font-weight:bold;
			color:#0070d2;
			margin-right:10px;
		}
	}
	.label_cont{
		padding:10px 20px;
		background:#fff;
		margin-bottom:10px;
		min-height:50px;
	}

	.dataTab {
		width: 730rpx;
		margin-left: 10rpx;
	}

	.scoreA{
		padding:5px 15px;
		background: #FFF;
		margin-bottom:10px;
	}

	.scoreB {
		padding: 5px 0 10px;
		margin-bottom: 10px;
		border-bottom:1px dashed #666;
	}
</style>
